package com.engineering.elink.common;
/**
 * 错误类型,0为正常处理返回,1**为客户端错误,2**为服务器错误(具体错误自定义,如101为请求参数错误)
 * 
 * ClassName: ErrorType <br/> 
 * Function: ADD FUNCTION. <br/> 
 * Reason: ADD REASON(可选). <br/> 
 * date: 2016年12月14日 下午6:21:25 <br/> 
 * 
 * @author zengxinyan 
 * @version  
 * @since JDK 1.8
 */
public enum ErrorType{
	SUCCESS							(0, "success"),
	CLIENT_ERROR					(1, "客户端未知错误"),
	SERVER_ERROR					(2, "服务器未知错误"),
	NEED_LOGIN						(-1, "请重新登录"),
	
	REQUEST_PARAMS_ERROR			(101, "请求参数不合法"),
	AUTHORITY_ERROR                 (102, "没有操作权限"),
	SESSION_TIMEOUT_ERROR		    (103, "session已超时"),
	REQUESTED_DATA_NOT_EXIST_ERROR	(104, "请求的数据不存在"),
	FILE_COMMENT_ERROR              (105, "您所评论的文件不存在"),
	COMMENT_REPLY_ERROR             (106, "您所回复的评论不存在"),
	COMMENT_PRAISE_ERROR            (107, "您所点赞的评论不存在"),
	FILE_DOWNLOAD_ERROR             (108,"您所下载的文件不存在"),
	REWARD_ERROR                    (109,"您的积分余额不足以下载该文件，请充值"),
    PRAISE_ERROR                    (110, "请不要重复顶/踩"),
    COLLECTION_SUCCESS              (111, "收藏成功"),
    CANCEL_COLLECTION               (112, "您已取消收藏"),
	FILE_TYPE_ERROR			        (113, "暂时不支持该文件格式"),

	
	DATABASE_ERROR                  (201, "数据库操作出错"),
	HANDLE_FILE_ERROR			    (203, "服务器处理文件出错"),
	
	PLANNHIER_ERROR                 (314, "规划体系信息不存在"),
	SKILL_EVALCOUNT_ERROR           (313, "您已评价当前技能，无需重复评价"),
	VIDEO_ERROR                     (312, "视频信息不存在"),
	SKILL_ERROR                     (311, "技能信息不存在"),
	VIDEO_COMMENTCOUNT_ERROR        (310, "您已评论当前视频，无需重复评论"),
	VIDEO_COMMENT_ERROR             (309, "您所评论的视频不存在"),
	EVALUATE_PRAISE_ERROR           (308, "您所点赞的评价不存在"),
	EVALUATE_REPLY_ERROR            (307, "您所回复的评价不存在"),
	COURSE_ADD_ERROR                (306, "添加课程产生错误"),
	COURSE_EVALCOUNT_ERROR          (305, "您已评价当前课程，无需重复评价"),
	ENROLL_ERROR                    (304, "您已报名当前课程，无需重复报名"),
	COURSE_ERROR                    (303, "课程信息不存在"),
	COURSE_ENROLL_ERROR             (302, "您未报名当前课程"),
	COURSE_EVALUATE_ERROR           (301, "您所评价的课程不存在"),
	
	CVDPROJECTEXP_UPDATE_ERROR      (416, "更新项目经验产生错误"),
	CVDEDUEXP_UPDATE_ERROR          (415, "更新教育经历产生错误"),
	CVDWORKEXPERIENCE_UPDATE_ERROR  (414, "更新工作经验产生错误"),
	CVD_ALL_ADD_ERROR               (413, "保存简历所有信息产生错误"),
	CVDPROJECTEXPERIENCE_ADD_ERROR  (412, "保存项目经验产生错误"),
	CVDEDUEXPERIENCE_ADD_ERROR      (411, "保存教育经历产生错误"),
	CVDWORKEXPERIENCE_ADD_ERROR     (410, "保存工作经验产生错误"),
	CVDBASEINFO_ADD_ERROR           (409, "简历基本信息保存产生错误"),
	CVDJOBINTENTION_ADD_ERROR       (408, "简历求职意向保存产生错误"),
	CVDATABASE_ERROR                (407, "简历信息不存在"),
	JOB_ADD_ERROR                   (406, "添加职位产生错误"),
	JOB_ERROR                       (405, "职位信息不存在"),
	COURSE_SERVICE_ERROR            (404, "发布修改课程请同意工程界相关服务条款！"),
	DELETE_COURSETYPE_ERROR         (403, "删除课程分类失败"),
	BATCH_UPDATECOURSE_ERROR        (402, "批量更新课程失败"),
	COURSETYPE_ERROR                (401, "课程分类管理信息不存在"),
	
	BATCH_CVD_ERROR                 (507, "批量移至简历库产生错误！"),
	CVD_VITA_DELIVERY_ERROR         (506, "简历投递信息不存在"),
	TARGET_COMPANY_ADD_ERROR        (505, "意向公司添加产生错误！"),
	TARGET_COMPANY_ERROR            (504, "最多只能选择3个意向公司！"),
	COMPANYVIEW_ERROR               (503, "公司信息不存在！"),
	DELIVERY_REPEAT_ERROR           (502, "您已投递过此公司职位，30天之内无法重复投递！"),
	DELIVERY_ADD_ERROR              (501, "投递简历产生错误"),
	
	UN_PLAY_VIDEO_ERROR            (610,"视频审核未通过，无法进行播放！"),
	UN_ENROLL_COURSE_ERROR         (609,"当前用户未报名当前课程，课程下视频无法进行播放！"),
	UPDATE_VIDEO_JSON_ERROR        (608,"传入修改视频JSON信息错误！"),
	UPDATE_VIDEO_ERROR             (607,"修改视频出错！"),
	GET_OSSID_ERROR                (606,"获取OSSID为空！"),
	USER_SYNC_ERROR                (605, "根据传入的seed和token无法获取到用户ID信息，无法执行同步视频！"),
	VIDEO_SYNC_ERROR               (604, "视频同步错误"),
	USERINFO_ERROR                 (603, "用户信息获取为空！"),
	COURSE_COLLECTION_ERROR        (602, "您收藏的课程已不存在！"),
	SEARCH_TYPE_ERROR              (601, "搜索类型不正确"),
	
	GET_CVDUSER_ERROR             (703, "简历ID与用户ID不能同时为空！"),
	VIDEO_NAME_ERROR              (702, "视频名称传入为空！"),
	BATCH_JOB_ERROR               (701, "批量删除职位错误！！！");
	
	private int code;
	private String msg;

	public int getCode() {
		return code;
	}

	public String getMsg() {
		return msg;
	}

	private ErrorType(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}
	
	/**
	 * 根据code获取到msg
	 * @param code
	 * @return
	 */
	public static String getMsgByCode(int code){
		for(ErrorType e:ErrorType.values()){
			if(e.getCode()==code){
				return e.getMsg();
			}
		}
		return null;
	}
	
}
